package edu.nf.project.webs.employeeAndCustomerInformation;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import edu.nf.project.entitys.dto.employeeAndCustomerInformation.CustomerDTO;
import edu.nf.project.entitys.entity.employeeAndCustomerInformation.convention.Member;
import edu.nf.project.services.employeeAndCustomerInformation.CustomerDTOService;
import edu.nf.project.services.exception.derivedAnomalies.MemberException;
import edu.nf.project.services.response.BaseController;
import edu.nf.project.services.response.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author CSY
 * @date 2025 - 06 - 11
 */
@RestController
@RequestMapping("/api/customerDTO")
public class CustomerDTOController extends BaseController {
    @Autowired
    private CustomerDTOService customerDTOService;

    @GetMapping("/customer-info/{uId}")
    public ResultVO<CustomerDTO> getCustomerByUserId(@PathVariable int uId) {
        try {
            CustomerDTO customerByUserId = customerDTOService.getCustomerByUserId(uId);
            return success(customerByUserId);
        } catch (Exception e) {
            throw new MemberException(50000, "系统错误，请稍后重试");
        }

    }
}
